package com.example;
 
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
@Configuration
public class ToolCallbackProviderConfig {
 
    /**
     * 将WeatherService实例注册为MCP工具，使其能够作为工具被调用
     * @param weatherService 包含Tool的天气服务
     * @return ToolCallbackProvider
     */
    @Bean
    public ToolCallbackProvider weatherTools(WeatherService weatherService) {
        return MethodToolCallbackProvider.builder().toolObjects(weatherService).build();
    }
}